package cn.lingyangwl.agile.food.model.rqrs.goods;

import cn.lingyangwl.agile.model.constants.ValidationCons;
import cn.lingyangwl.agile.model.module.dict.CusFieldBind;
import cn.lingyangwl.agile.model.module.dict.DictTypeCons;
import cn.lingyangwl.agile.food.model.entity.GoodsAttribute;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;

/**
 * 商品
 *
 * @author shenguangyang
 */
@Getter
@Setter
@Accessors(chain = true)
public class GoodsBase {
    @ApiModelProperty(value = "产品分类名称")
    @NotNull(message = ValidationCons.NOT_EMPTY)
    private Long categoryId;

    @ApiModelProperty(value = "商品图片")
    private List<String> images;

    @ApiModelProperty(value = "商品名称")
    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    private String name;

    @ApiModelProperty(value = "商品描述")
    private String detailContent;

    @ApiModelProperty(value = "推荐状态, 1: 推荐, 0: 不推荐")
    private String recommandStatus;

    @ApiModelProperty(value = "商品编号")
    private String goodsNo;

    @ApiModelProperty(value = "库存预警值")
    @NotNull(message = ValidationCons.NOT_EMPTY, groups = UnifySpecGoods.class)
    private Integer stockAlarm;

    @ApiModelProperty(value = "单位")
    @NotEmpty(message = ValidationCons.NOT_EMPTY)
    private String unit;

    @ApiModelProperty(value = "商品重量，默认为克")
    @NotNull(message = ValidationCons.NOT_EMPTY, groups = UnifySpecGoods.class)
    private BigDecimal weight;

    @ApiModelProperty(value = "新品状态 0: 不是新品；1: 新品")
    private String newStatus = "1";

    @ApiModelProperty(value = "销量")
    private Integer saleNumber;

    @ApiModelProperty(value = "排序")
    private Integer sortNo;

    @NotNull(message = ValidationCons.NOT_EMPTY, groups = UnifySpecGoods.class)
    @ApiModelProperty(value = "价格")
    private BigDecimal price;

    @NotNull(message = ValidationCons.NOT_EMPTY, groups = UnifySpecGoods.class)
    @ApiModelProperty(value = "成本价格")
    private BigDecimal costPrice;

    @ApiModelProperty(value = "包装费用")
    private BigDecimal bagPrice;

    @ApiModelProperty(value = "状态, 1: 已上架, 2: 未上架")
    private String status;

    @ApiModelProperty(value = "最低购买数量")
    @NotNull(message = ValidationCons.NOT_EMPTY)
    private Integer minBuy;

    @ApiModelProperty(value = "商品类型, 多个之间用逗号隔开")
    @NotNull(message = ValidationCons.NOT_EMPTY)
    @Size(min = 1, message = ValidationCons.NOT_EMPTY)
    @CusFieldBind(type = DictTypeCons.GOODS_TYPE, target = "goodsTypeTexts")
    private List<String> goodsTypes;

    private List<String> goodsTypeTexts;

    @ApiModelProperty(value = "是否为多规格")
    @NotNull(message = ValidationCons.NOT_EMPTY)
    private Boolean multiSpec;

    @ApiModelProperty(value = "划线价格")
    private BigDecimal linePrice;

    @ApiModelProperty(value = "属性")
    private List<GoodsAttribute> attributeList = Collections.emptyList();
}
